package com.wonders.frame.autoGeneration.task;

import com.wonders.frame.autoGeneration.support.TaskContent;
import com.wonders.frame.autoGeneration.task.Core.Task;
import com.wonders.frame.common.util.FileUtil;
import com.wonders.frame.common.util.HumpUtil;

import java.io.File;
import java.util.concurrent.Callable;

/**
 * @author 顾乘瑞
 */
public class GenCssTask extends Task {
    private static final String PATH = System.getProperty("file.separator") +"src"
            + System.getProperty("file.separator") + "main"
            + System.getProperty("file.separator") + "resources"
            + System.getProperty("file.separator") + "frontend"
            + System.getProperty("file.separator") + "css"
            + System.getProperty("file.separator");

    public GenCssTask(final TaskContent cont){
        super(cont);
    }
    @Override
    public Object call(){
        String tableName = cont.getTableName();
        String entityClassName = HumpUtil.tableName2ClassName(tableName);
        String className = entityClassName + "Css";

        String filePath = TaskContent.PROJECT_PATH + PATH;
        File file = new File(filePath);
        if (!file.exists()) {
            file.mkdirs();
        }
        String writeFilePath = filePath + className + ".css";
        FileUtil.createFile("", writeFilePath);
        return null;
    }
}
